package com.cci.kangdao.wechatOrder.service;

import com.cci.kangdao.dao.model.UserT;
import com.cci.kangdao.wechatOrder.model.UserOutSideTokenT;

/**
 * @description: 生成外部用户token服务
 * @author: zyf
 * @create: 2021-03-25
 */
public interface IOutSideTokenService {
    /**
     * 生成token
     *
     * @param tokenT
     * @param userT
     * @return
     * @throws Exception
     */
    UserOutSideTokenT generateToken(UserOutSideTokenT tokenT, UserT userT) throws Exception;

    UserT getUserByWeChatToken(Long companyId, Integer type, String outSideId) throws Exception;

    UserOutSideTokenT getOutSideToken(String outSideId, String token) throws Exception;

    void setCacheUser(Long companyId, Integer type, String outSideId, UserT userT) throws Exception;

    void setCacheOutSideToken(String outSideId, String token, UserOutSideTokenT tokenT) throws Exception;

    /**
     * 注册微信用户
     * @param openId
     * @param token
     * @param userT
     * @throws Exception
     */
    void registerWeChatUser(String openId, String token, UserT userT, Long companyID) throws Exception;

    /**
     * 替换解绑微信用户
     * @param openId
     * @param oldOpenId
     * @param token
     * @param userT
     * @throws Exception
     */
    void replaceWeChatUser(String openId, String oldOpenId, String token, UserT userT) throws Exception;


}
